import {
  request
} from './request'

export function getCateList(queryInfo) {
  return request({
    url: 'categories',
    params: queryInfo
  })
}

export function getParentCateList(type = 1) {
  return request({
    url: 'categories',
    params: {
      type
    }
  })
}

export function addCate(cateForm) {
  return request({
    url: 'categories',
    method: 'post',
    data: cateForm
  })
}

export function getCateNameById(id) {
  return request({
    url: 'categories/' + id,
  })
}

export function submitEditedCate(id, cat_name) {
  return request({
    url: 'categories/' + id,
    method: 'put',
    data: {
      cat_name
    }
  })
}

export function deleteCateInfoById(id) {
  return request({
    url: 'categories/' + id,
    method: 'delete'
  })
}